package cn.iocoder.yudao.module.erp.dal.mysql.monthplaninfo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.erp.dal.dataobject.monthplaninfo.MonthPlanInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.erp.controller.admin.monthplaninfo.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 月度计划 Mapper
 *
 * @author mhc
 */
@Mapper
public interface MonthPlanInfoMapper extends BaseMapperX<MonthPlanInfoDO> {

    @TenantIgnore
    int updateThisAccount(@Param("monthPlanInfoDO") MonthPlanInfoDO monthPlanInfoDO);

    default PageResult<MonthPlanInfoDO> selectPage(MonthPlanInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MonthPlanInfoDO>()
                .likeIfPresent(MonthPlanInfoDO::getName, reqVO.getName())
                .betweenIfPresent(MonthPlanInfoDO::getBeginTime, reqVO.getBeginTime())
                .betweenIfPresent(MonthPlanInfoDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(MonthPlanInfoDO::getUpId, reqVO.getUpId())
                .eqIfPresent(MonthPlanInfoDO::getDownloadId, reqVO.getDownloadId())
                .eqIfPresent(MonthPlanInfoDO::getCheckType, reqVO.getCheckType())
                .eqIfPresent(MonthPlanInfoDO::getCheckCompany, reqVO.getCheckCompany())
                .betweenIfPresent(MonthPlanInfoDO::getLinePrice, reqVO.getLinePrice())
                .likeIfPresent(MonthPlanInfoDO::getLineInfo, reqVO.getLineInfo())
                .likeIfPresent(MonthPlanInfoDO::getGasResource, reqVO.getGasResource())
               /* .betweenIfPresent(MonthPlanInfoDO::getUsedSaleCount, reqVO.getUsedSaleCount())
                .betweenIfPresent(MonthPlanInfoDO::getUsedBuyCount, reqVO.getUsedBuyCount())*/
                .eqIfPresent(MonthPlanInfoDO::getSaleCustomerId, reqVO.getSaleCustomerId())
                .betweenIfPresent(MonthPlanInfoDO::getSalePrice, reqVO.getSalePrice())
                /*.betweenIfPresent(MonthPlanInfoDO::getSaleOtherCount, reqVO.getSaleOtherCount())*/
                .eqIfPresent(MonthPlanInfoDO::getSaleOtherPrice, reqVO.getSaleOtherPrice())
               /* .eqIfPresent(MonthPlanInfoDO::getSaleGasAllCount, reqVO.getSaleGasAllCount())
                .eqIfPresent(MonthPlanInfoDO::getSaleSubCount, reqVO.getSaleSubCount())*/
                .eqIfPresent(MonthPlanInfoDO::getSaleContractId, reqVO.getSaleContractId())
                .eqIfPresent(MonthPlanInfoDO::getBuyCustomerId, reqVO.getBuyCustomerId())
                .eqIfPresent(MonthPlanInfoDO::getBuyPrice, reqVO.getBuyPrice())
                .eqIfPresent(MonthPlanInfoDO::getBuyOtherPrice, reqVO.getBuyOtherPrice())
               /* .eqIfPresent(MonthPlanInfoDO::getBuyGasAllCount, reqVO.getBuyGasAllCount())
                .eqIfPresent(MonthPlanInfoDO::getBuySubCount, reqVO.getBuySubCount())
                .eqIfPresent(MonthPlanInfoDO::getBuyAllCount, reqVO.getBuyAllCount())*/
                .eqIfPresent(MonthPlanInfoDO::getBuyContractId, reqVO.getBuyContractId())
              /*  .eqIfPresent(MonthPlanInfoDO::getStatus, reqVO.getStatus())*/
                .eqIfPresent(MonthPlanInfoDO::getRemark, reqVO.getRemark())
                .eqIfPresent(MonthPlanInfoDO::getFileUrl, reqVO.getFileUrl())
                .betweenIfPresent(MonthPlanInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MonthPlanInfoDO::getId));
    }

}